package HighConcurrency.JUC;

import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;

public class ConcurrentNavigableMapDemo {
    public static void main(String[] args) {

        ConcurrentNavigableMap<String, Integer> map1 = new ConcurrentSkipListMap<>();
        //ConcurrentSkipListMap并发跳跃表
        map1.put("aaa",11);
        map1.put("bbb",22);
        map1.put("ccc",33);
        map1.put("ddd",44);

        //从制定键开始截取到末尾
        System.out.println(map1.tailMap("bbb"));
        //从头到指定键截取
        System.out.println(map1.headMap("ccc"));
        //截取指定范围的键值对
        System.out.println(map1.subMap("bbb","ddd"));

        //跳跃表，针对有序数据的查询性能很好，
        // 但是插入删除性能很差，因为需要重新排序。
        //跳跃表允许层层提取，最上层元素个数不少于2，典型的以空间换时间的产物
        //当新增元素，遵循抛硬币原则
        //时间复杂度O(logn)




    }
}
